# $Id: makefile.in,v 7.3 1995/05/14 21:42:55 tom Exp $
# Makefile-template for 'c_count'

THIS = c_count
RELEASE = 7

#### Start of system configuration section. ####

@SET_MAKE@
srcdir = @srcdir@
VPATH  = @srcdir@

CC		= @CC@
LINK		= $(CC)
INSTALL		= @INSTALL@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@

LIBS		= @LIBS@
CFLAGS		= @CFLAGS@
LDFLAGS		=

prefix		= @prefix@
exec_prefix	= @exec_prefix@

bindir		= $(exec_prefix)/bin
libdir		= $(exec_prefix)/lib
mandir		= $(prefix)/man/man1
manext		= 1

#### End of system configuration section. ####

SHELL		= /bin/sh

CPPFLAGS	= -I. -I$(srcdir) -DHAVE_CONFIG_H

LDFLAGS		= 

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<

SRC = CHANGES patchlev.h \
	README $(THIS).c $(THIS).1 \
	config_h.in install.sh mkdirs.sh makefile.in configure.in

OBJ = $(THIS).o

DISTFILES = configure $(SRC)

all:	$(THIS)

$(THIS): $(OBJ)
	-mv $(THIS) o$(THIS)
	$(LINK) $(LDFLAGS) -o $(THIS) $(OBJ) $(LIBS)

install: all installdirs
	$(INSTALL_PROGRAM) $(THIS) $(bindir)/$(THIS)
	$(INSTALL_DATA) $(srcdir)/$(THIS).1 $(mandir)/$(THIS).$(manext)

installdirs:
	$(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(libdir) $(mandir)

uninstall:
	rm -f $(bindir)/$(THIS) $(mandir)/$(THIS).$(manext)

makefile: makefile.in config.status
	./config.status

config.h: configure
	./configure

config.status: configure
	./config.status --recheck

mostlyclean:
	- rm -f *.o o$(THIS) core *~ *.BAK
	- rm -f Part?? part.*

clean: mostlyclean
	- rm -f $(THIS)

distclean: clean
	- rm -f makefile config.log config.cache config.status config.h

realclean: distclean
	- rm -f tags TAGS # don't remove configure!

check: $(THIS)
	cd testing; $(MAKE) run_test

lint:
	lint $(THIS).c

tags:
	ctags $(THIS).c $(HDRS)

TAGS:
	etags $(THIS).c $(HDRS)

# I keep my sources in RCS, and assign a symbolic release to the current patch
# level.  The 'manifest' script knows how to build a list of files for a given
# revision.
MANIFEST: patchlev.h
	manifest -rv$(RELEASE)`fgrep PATCHLEVEL patchlev.h | sed -e s'/^[^0-9]*/_/'` \
		testing/case*.dcl testing/case*.bat

dist: MANIFEST
	- rm -f .fname .files
	fgrep PATCHLEVEL patchlev.h | sed -e 's/[^0-9.]//g' -e 's/^/$(THIS)-$(RELEASE)./' >.fname
	cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files
	rm -rf `cat .fname`
	TOP=`cat .fname`; mkdir $$TOP `cat .files | grep / | sed -e 's@/.*@@' | sed -e s@\^@$$TOP/@ | uniq`
	for file in `cat .files`; do \
	  ln $(srcdir)/$$file `cat .fname`/$$file \
	    || { echo copying $$file instead; cp $$file `cat .fname`/$$file; }; \
	done
	tar -cf - `cat .fname` | gzip >`cat .fname`.tgz
	rm -rf `cat .fname` .fname .files

# Some of the output will be uuencoded because the test scripts include
# <CR><LF> terminated ".bat" files for MS-DOS.
dist-shar: MANIFEST
	- rm -f .fname .files
	fgrep PATCHLEVEL patchlev.h | sed -e 's/[^0-9.]//g' -e 's/^/$(THIS)-$(RELEASE)./' >.fname
	cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files
	shar -M -n`cat .fname` -opart -l50 `cat .files`
	- rm -f .fname .files

# This uses Rick Salz's cshar to make a set of shar-files.
# (It'll clobber the version info in MANIFEST, and doesn't restore timestamps,
# but that's another bag of worms).
dist-cshar: MANIFEST
	makekit -m

$(THIS).o:	config.h
